package com.cgw.room.util;

import android.graphics.Bitmap;

public class BitmapUtil {
    public static Bitmap resizeBitmap(Bitmap original, float scale) {
        if (original == null) {
            return null;
        }

        int width = original.getWidth();
        int height = original.getHeight();
        int newWidth = (int)(width * scale);
        int newHeight = (int)(height * scale);

        // 创建一个新的Bitmap对象来存放缩放后的图片
        Bitmap resized = Bitmap.createScaledBitmap(original, newWidth, newHeight, false);
        return resized;
    }
}
